package com.example.songjie.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        onclickMyact();
        //android.content.Intent it = new android.content.Intent(MainActivity.this, MyActivity.class);
        //startActivity(it);
    }

    protected void onclickMyact() {
        android.widget.Button But = findViewById(com.example.songjie.myapplication.R.id.But);
        But.setOnClickListener(new android.view.View.OnClickListener() {
            @Override
            public void onClick(android.view.View v) {
                android.content.Intent it = new android.content.Intent(MainActivity.this, MyActivity.class);

                Bundle bd=new android.os.Bundle();
                bd.putString("name","cao");
                it.putExtras(bd);
                startActivity(it);
                //finish();
            }
        });
    }
}
